<template>
  <scroll-view scroll-y style="height: 100vh" @scrolltolower="scrolltolower">
    <details-member ref="detailsMember" :options="page.options"></details-member>
  </scroll-view>
</template>

<script setup>
  import { nextTick, onMounted, reactive, ref } from 'vue';
  import { onLoad, onShareAppMessage, onShow } from '@dcloudio/uni-app';
  import DetailsMember from '@/pages/familyPage/components/detailsMember.vue';

  const page = reactive({
    options: {},
  });
  const detailsMember = ref();
  onLoad((options) => {
    page.options = options;
  });

  onShow(() => {
    nextTick(async () => {
      await detailsMember._value.getPersonalDetails();
      await detailsMember._value.getPersonalAlbum();
      await detailsMember._value.getPersonalAnniversary();
      await detailsMember._value.getPersonalCircle();
      // 获取用心记
      await detailsMember._value.getLearnSwiper();
    });
  });

  function scrolltolower() {
    if (detailsMember.value.circlePage * detailsMember.value.circlePagesize < detailsMember.value.circleTotal) {
      detailsMember.value.circlePage++;
      detailsMember._value.getPersonalCircle();
    }
  }

  // #ifdef MP-WEIXIN
  onShareAppMessage((res) => {
    console.log(res);
    // 家庭圈分享
    if (res.from == 'button') {
      return {
        title: res.target.dataset.info.circle.content.replace(/<[^>]*>/g, ''),
        path: res.target.dataset.path,
        imageUrl: !!res.target.dataset.info.circle.images && res.target.dataset.info.circle.images.length > 0 ? res.target.dataset.info.circle.images[0].image : `${IMG_URL.value}/index/share_background_defult.png`,
      };
    }
  });
  // #endif
</script>


<style scoped lang="scss">

</style>
